<template>
    <div class="categroy-wrapper main">
        <nav-bar>
            <template v-slot:back>
                <back-button/>
            </template>
            <template v-slot:title>
                <h1 class="base-font-color">分类名册</h1>
            </template>
            <template v-slot:right>
                <button class="base-button" @click="focus">我的关注</button>
                <button class="base-button" @click="routerEvent('/home')">首页</button>
            </template>
        </nav-bar>
        <div class="base-content">
            <ul class="clearfix categroy-menu">
                <li v-for="(item, i) in menus" :key="i" @click="itemClick(item)">
                    <h3 class="label">{{i + 1}}、{{item.label}}</h3>
                </li>
            </ul>
        </div>
    </div>
</template>

<script>
    import {navbarMixin} from "../mixins";

    export default {
        name: "Category",
        mixins: [navbarMixin],
        data() {
            return {
                menus: [
                    {label: '厅级干部', api: 'GetTingJiSimpleInfoArray'},
                    {label: '二级巡视员', api: 'GetErXunSimpleInfoArray'},
                    {label: '非党干部', api: 'getNOCCPInfos'},
                    {label: '女性干部', api: 'GetFemaleSimpleInfoArray'},
                    {label: '40岁以下县级干部', api: 'GetUnder40SimpleInfoArray'},
                    {label: '少数民族干部', api: 'GetMinoritySimpleInfoArray'},
                ]
            }
        },
        methods: {
            itemClick(item) {
                this.$router.push({path: '/searchResult', query: {api: item.api, subTitle: item.label, page: '4'}});
            },
            focus() {
                this.$router.push({path: '/searchResult', query: {page: 1}});
            },
            routerEvent(path) {
                this.$router.push(path);
            }
        }
    };
</script>

<style scoped lang="scss">
    @import "../assets/scss/define";
    .categroy-wrapper {
        .categroy-menu {
            width: 80%;
            margin: 0 auto;
            > li {
                width: 50%;
                padding: 10px;

                > .label {
                    color: $base-color;
                    background-color: #e3e3e380;
                    line-height: 70px;
                    text-align: left;
                    padding-left: 10px;
                    font-size: 22px;
                }
            }
        }
    }
</style>
